package com.car.serve.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.car.commons.core.model.Result;
import com.car.serve.entity.ServeProjectModifyLog;
import com.car.serve.exception.ServeException;
import com.car.serve.form.ServeProjectModifyLogForm;
import com.car.serve.service.ServeProjectModifyLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.security.sasl.SaslException;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 董旭
 * @since 2024-08-28
 */
@RestController
@RequestMapping("/serveProjectModifyLog")
@Api(tags = "项目日志信息")
public class ServeProjectModifyLogController {

    @Resource
    private ServeProjectModifyLogService serveProjectModifyLogService;

    @GetMapping("/findByIdServeProjectModifyLog")
    @ApiOperation(value = "根据ID查询项目日志表")
    public Result findByIdserveProjectModifyLog(Integer id)throws Exception{
        ServeProjectModifyLog modifyLog = serveProjectModifyLogService.getById(id);
        if (modifyLog==null)throw new ServeException(3000,"不存在项目日志");
        return Result.getResult().setMsg("查询成功").setData(modifyLog);
    }

    @PostMapping("/findPageServeProjectModifyLog")
    @ApiOperation(value = "分页查询")
    public Result findPageServeProjectModifyLog(@RequestBody ServeProjectModifyLogForm form)throws Exception{
        Page<ServeProjectModifyLog> pageServeProjectModifyLog = serveProjectModifyLogService.findPageServeProjectModifyLog(form);
        return Result.getResult().setMsg("分页查询成功").setData(pageServeProjectModifyLog);
    }

}

